package alarmdisplay;

import java.io.*;

import org.apache.log4j.BasicConfigurator;
import org.apache.log4j.Logger;

public class Debug {

    private final static Logger log = Logger.getLogger(Debug.class);
    private static boolean DEBUG = true;
    private static BufferedWriter out = null;
    private static boolean isConf = false;
    public Debug(){
        BasicConfigurator.configure();
    }
    /**
     * Debugmeldungen fuer alle
     */
    public static void debug(String strMelder, String strMessage) {
        debug(strMelder, strMessage, 1);
    }

    public static void debug(String strMelder, String strMessage, int iLevel) {
        if (isConf == false) {
            BasicConfigurator.configure();
            isConf = true;
        }
        if (iLevel == 1) {
            log.debug(strMelder + " - " + strMessage);
        } else if (iLevel == 2) {
            log.info(strMelder + " - " + strMessage);
        } else if (iLevel == 3) {
            log.error(strMelder + " - " + strMessage);
        }
        //System.out.println(strMelder + " - " + strMessage);
    }
}
